import type { ProColumns } from '@ant-design/pro-table';
export type columnsDataType = {
  custNo: string;
  disctNo: string,
  disctNm: string,
  enableTime: string,
  status: string,
  disctMinLmt: number,
  disctUpLimit: number,
  disctRate: number,
  memRate: number,
  pltRate: number,
  recRate: number
};
const columnsData: ProColumns<columnsDataType>[] = [

  // 配置搜索框
  {
    title: '折扣编码',
    dataIndex: 'disctNo',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '商户名',
    dataIndex: 'custName',
    hideInTable: true,
    fieldProps: {
      maxLength: 20
    },
  },
  {
    title: '状态',
    dataIndex: 'status',
    valueType: 'select',
    hideInTable: true,
    valueEnum: {
      0: {
        text: '生效'
      },
      1: {
        text: '失效'
      },
      2: {
        text: '未生效'
      }
    },
  },
  {
    title: '创建日期',
    dataIndex: 'configurationDate',
    hideInTable: true,
    valueType: 'dateRange',
    search: {
      transform: (value) => {
        return {
          startDate: value[0],
          endDate: value[1],
        };
      },
    },
  },
  // table里面的内容
  {
    title: '商户名',
    dataIndex: 'custName',
    hideInSearch: true,
    width: 120,
    fixed: 'left',
  },
  {
    title: '折扣编码',
    dataIndex: 'disctNo',
    hideInSearch: true,
    width: 160,
    fixed: 'left',
  },
  {
    title: '折扣名称',
    dataIndex: 'disctNm',
    hideInSearch: true,
    width: 150,
  },
  {
    title: '创建时间',
    dataIndex: 'createdTime',
    colSize: 1.5,
    hideInSearch: true,
    width: 150,
  },
  {
    title: '生效时间',
    dataIndex: 'enableTime',
    colSize: 1.5,
    hideInSearch: true,
    width: 150,
  },
  {
    title: '失效时间',
    dataIndex: 'unenableTime',
    colSize: 1.5,
    hideInSearch: true,
    width: 150,
  },
  {
    title: '折扣状态',
    dataIndex: 'status',
    valueType: 'select',
    hideInSearch: true,
    width: 80,
    valueEnum: {
      0: {
        text: '生效',
        status: 'Success',
      },
      1: {
        text: '失效',
        status: 'Error',
      },
      2: {
        text: '未生效',
        status: 'Default',
      },
    },
  },
  {
    title: '折扣抵消条件(CAD)',
    dataIndex: 'disctMinLmt',
    hideInSearch: true,
    width: 180,
  },
  {
    title: '折扣总比例',
    dataIndex: 'disctRate',
    hideInSearch: true,
    width: 100,
  },
  {
    title: '会员占比',
    dataIndex: 'memRate',
    hideInSearch: true,
    width: 80,
  },
  {
    title: '平台占比',
    dataIndex: 'pltRate',
    hideInSearch: true,
    width: 80,
  },
  {
    title: '推荐人占比',
    dataIndex: 'recRate',
    hideInSearch: true,
    width: 100,
  },
  {
    title: '操作',
    width: 120,
    fixed: 'right',
    align: 'center',
    valueType: 'option',
  }
];

export default columnsData;